<?php
namespace common\sources\write\financeconfig;

use \common\models\craftsman\FinanceConfig;

class FinanceConfigAccess implements IFinanceConfigAccess
{
    public function RefundConfig($data) {
        $config = FinanceConfig::find()
            ->where(['ConfigName' => $data['ConfigName']])
            ->one();
        if (!$config) {
            $config = new FinanceConfig();
        }
        $config->ConfigName = $data['ConfigName'];
        $config->ConfigDesc = $data['ConfigDesc'];
        $config->ConfigValue = $data['ConfigValue'];
        if ($config->save()) {
            return true;
        }
        return false;
    }
}